<template>
     <el-button type="primary" @click="dialogFormVisible = true">新增管理员</el-button>
      <addminForm v-if="dialogFormVisible" v-model="dialogFormVisible" @click="handler"/>
      <!--   -->
</template>

<script setup>
import {ref,reactive} from "vue"
// import { addAdminUserApi } from "@/views/user_management/hook.js";
import addminForm from "./addminForm.vue";
import {addAdminUserApi} from '@/api/adminuserApi.js'


let dialogFormVisible = ref(false)
  // const tableData=[{
  //   usernum:'admin',
  //   name:'管理员',
  //   js:'超级管理员',
  //   bz:"",
  //   lasttime:'2023-04-21 22:00:05',
  //   lip:'183.69.214.167',
  // }]
const emit = defineEmits(['click'])
  const handler=async (form)=>{
    dialogFormVisible.value=false
    if(form==1){
    }else{
      let ret = await addAdminUserApi(form);
      console.log(ret.data.adminusers);
      emit('click',ret.data.adminusers)
    }
    
    // let [data, tableData, total] = useUserList();
    // dialogFormVisible = false
  }
  
</script>

<style lang="scss" scoped>

</style>